<?php

namespace console\migrations;

use Yii;

/**
 * Class Base
 * @package task\migrations
 * @property string|null $tableOptions
 */
abstract class Base extends \yii\db\Migration
{
    protected string $tableComment;

    protected function getTableOptions(): ?string
    {
        $tableOptions = '';
        if ($this->db->driverName === 'mysql') {
            $tableOptions .= ' CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }
        if (isset($this->tableComment)) {
            $tableOptions .= " COMMENT '{$this->tableComment}'";
        }
        return $tableOptions ?: null;
    }
}